package com.xly.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xly.entity.CheckReport;
import com.xly.service.ReportService;
import com.xly.util.JsonUtil;

/** 
* @author Your-Name: Carey
* @version Create-Date：2020年3月17日 下午7:20:24 
* Class Description:
*/
@RestController
@RequestMapping("/report")
public class ReportController {

	@Autowired
	private ReportService reportServcie;
	
	//条件查询
	@RequestMapping(value="/getList",produces="text/html;charset=UTF-8")
	public JsonUtil getList(String username, int diagnostictype, String inspectionitems,
			String symptom, String diagnosticresult) {
		List<Map<String,Object>> list = reportServcie.selectCondition(username, diagnostictype,
				inspectionitems, symptom, diagnosticresult);
		return JsonUtil.success(list);
	}
	
	//根据检查报告id获取详情
	@RequestMapping(value="/getDetailById",produces="text/html;charset=UTF-8")
	public JsonUtil getDetailById(int id) {
		List<CheckReport> list = reportServcie.selectById(id);
		return JsonUtil.success(list);
	}
	
	//更新 
	@RequestMapping(value="/updateById",produces="text/html;charset=UTF-8")
	public boolean updateById(CheckReport report) {
		int i = reportServcie.updateById(report);
		if(i>0) {
			return true;
		}
		return false;
	}
	
	//更新 
	@RequestMapping(value="/add",produces="text/html;charset=UTF-8")
	public boolean add(CheckReport report) {
		int i = reportServcie.insertReport(report);
		if(i>0) {
			return true;
		}
		return false;
	}
	
}
